This project was initially setup in rails... the thing is I started learning with rails and once I shifted into learning Javascript I kept setting it up mainly for practice (didn't want to completely forget things) and to make use of ENV[variables]
when it came to keys and such.
When it came to creating the Javascript Calculator however-- it really wasn't necessary, not even a little bit. But, out of habit, that's how I set it up.
I had every intention of going back once I was done and migrate only the necessary files from the original repo into a clean repo/project. Which I did hence this post :).
created simple project with only files necessary [eg: html, css, js]
The gist:
images
folder, styles
folder, and script
folderstyles
folderscripts
folderimages
foldermy edits:
index.html.erb
=> took out erb
master.css.scss
=> took out scss
main.js
=> created/moved into its own folder, out of index.html
file
additional edits:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="styles/master.css" rel="stylesheet" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
</script>
<title>calculatorJS</title>
</head>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="styles/master.css" rel="stylesheet" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
</script>
<title>calculatorJS</title>
</head>
<body>
<div class="container">
<div class="main">
<div class="black-top"></div>
<div class="display">
<br /><br />
<span class="model">CASIO pocket-8S</span><br />
<span class="title"><small>ELECTRONIC CALCULATOR</small></span>
<br /><br /><br />
<span class="results">0</span>
<br /><br />
<span class="mem"><small>0</small></span>
</div> <!-- end of display -->
<div id="buttons">
<button id="solar" value=''>o |||</button>
<button id="ac" value=''>AC</button>
<button id="c" value=''>C</button>
<button id="percent" value=''>%</button><br />
<button id="seven" value='7'>7</button>
<button id="eight" value='8'>8</button>
<button id="nine" value='9'>9</button>
<button id="divide" value='/'>/</button><br />
<button id="four" value='4'>4</button>
<button id="five" value='5'>5</button>
<button id="six" value='6'>6</button>
<button id="multiply"value='*'>x</button><br />
<button id="one" value='1'>1</button>
<button id="two" value='2'>2</button>
<button id="three" value='3'>3</button>
<button id="sub" value='-'>-</button><br />
<button id="zero" value='0'>0</button>
<button id="deci" value='.'>.</button>
<button id="equals" value=''>=</button>
<button id="add" value='+'>+</button>
</div> <!-- end of buttons -->
<div class="black-bottom"></div>
</div> <!-- end of main -->
</div><!-- end of container -->
</body>
</html>
<script src="scripts/main.js"></script>
another edit master.css
was for background image to show in browser
url(../images/wood.png);
no-repeat
had to be taken out from next to url, which worked within rails env, but not as standalone-- it had to be placed in its own line background-repeat:
body {
background-image: url(../images/wood.png);
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-repeat: no-repeat center center fixed;
}